package com.guomei.mapper.curse;

import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.guomei.bean.exam.domain.ExamAnswer;

import java.util.List;

/**
 * 考试答卷Mapper接口
 */
public interface ExamAnswerMapper extends BaseMapper<ExamAnswer> {
    
    /**
     * 根据ID查询
     */
    ExamAnswer selectById(@Param("id") Long id);
    
    /**
     * 查询所有
     */
    List<ExamAnswer> selectAll();
    
    /**
     * 条件查询
     */
    List<ExamAnswer> selectByCondition(ExamAnswer examAnswer);
    
    /**
     * 新增
     */
    int insert(ExamAnswer examAnswer);
    
    /**
     * 批量新增
     */
    int batchInsert(List<ExamAnswer> examAnswers);
    
    /**
     * 根据ID更新
     */
    int updateById(ExamAnswer examAnswer);
    
    /**
     * 根据ID删除
     */
    int deleteById(@Param("id") Long id);
    
    /**
     * 批量删除
     */
    int batchDelete(@Param("ids") List<Long> ids);
    
    /**
     * 根据考试ID查询
     */
    List<ExamAnswer> selectByExamId(@Param("examId") Long examId);
    
    /**
     * 根据用户ID查询
     */
    List<ExamAnswer> selectByUserId(@Param("userId") Long userId);
    
    /**
     * 根据报名ID查询
     */
    List<ExamAnswer> selectByEnrollId(@Param("enrollId") Long enrollId);
    
    /**
     * 根据考试ID和用户ID查询
     */
    ExamAnswer selectByExamIdAndUserId(@Param("examId") Long examId, @Param("userId") Long userId);
    
    /**
     * 根据报名ID和用户ID查询
     */
    ExamAnswer selectByEnrollIdAndUserId(@Param("enrollId") Long enrollId, @Param("userId") Long userId);
    
    /**
     * 根据状态查询
     */
    List<ExamAnswer> selectByStatus(@Param("status") Short status);
    
    /**
     * 根据审核人ID查询
     */
    List<ExamAnswer> selectByReviewUserId(@Param("reviewUserId") Long reviewUserId);
    
    /**
     * 根据审核结果查询
     */
    List<ExamAnswer> selectByReviewResult(@Param("reviewResult") Short reviewResult);
    
    /**
     * 根据考试ID删除
     */
    int deleteByExamId(@Param("examId") Long examId);
    
    /**
     * 根据用户ID删除
     */
    int deleteByUserId(@Param("userId") Long userId);
    
    /**
     * 根据报名ID删除
     */
    int deleteByEnrollId(@Param("enrollId") Long enrollId);
    
    /**
     * 统计用户答卷数量
     */
    int countByUserId(@Param("userId") Long userId);
    
    /**
     * 统计考试答卷数量
     */
    int countByExamId(@Param("examId") Long examId);
    
    /**
     * 统计待审核答卷数量
     */
    int countByStatus(@Param("status") Short status);
}
